*------------------------------------------------------------------------------------------------------------------------------
* DATA RECODES
*------------------------------------------------------------------------------------------------------------------------------
cd "F O L D E R" /* Change this with the path to the folder where you unpacked the replication material */
use "data_fakenews.dta", clear

* ID
gen id = ORDINE

* DV
gen plaus = .
replace plaus = W11_Q122 if W11_Q121 == 1
replace plaus = W11_Q123 if W11_Q121 == 2
replace plaus = W11_Q124 if W11_Q121 == 3
replace plaus = W11_Q125 if W11_Q121 == 4
replace plaus = W11_Q126 if W11_Q121 == 5
replace plaus = W11_Q127 if W11_Q121 == 6
replace plaus = plaus - 1

* Treatments
recode W11_Q121 (2 4 6 = 0 "Real") (1 3 5 = 1 "False"), gen(fake)

recode W11_Q121 (1 2 = 1 "Non political") (3 4 = 2 "Political/Against Govt") (5 6 = 3 "Political/Pro Govt"), gen(typen)

* Government evaluation
gen gov_eval = .
replace gov_eval = (W11_Q014 - 1) if W11_Q014 < 12


* Political knowledge 
* (code by Silvia Keeling - in a separate script because too long, also computes polychoric Cronbach's alpha)
do "./recode_knowledge.do"
sum polknow_irt /* reported in the section "Data, variables and modeling strategy" */

* Vote (blocs)
gen vote = .
replace vote = 1 if W11_Q096 >= 5 & W11_Q096 <= 8 | W11_Q097 == 1
replace vote = 2 if W11_Q096 >= 1 & W11_Q096 <= 4 | W11_Q097 == 2
replace vote = 3 if W11_Q096 == 10 | W11_Q097 == 3
replace vote = 4 if W11_Q096 == 9 | W11_Q097 == 4
replace vote = 0 if W11_Q094 == 2

label define bloc 0 "NV" 1 "CSX" 2 "CDX" 3 "M5S" 4 "LEU"
label values vote bloc

* Vote incumbent + challenger
recode vote (1 = 1 "Incumbent") (2 3 4 = 0 "Challenger") (0 = .), gen(vote_inc)

* Education
recode W11_Q130 (1 2 3 = 1 "Low") (4 5 = 2 "Mid") (6/11 = 3 "High") (0 = .), gen(edu)

* Age
destring W11_Q006, gen(anno)
gen age = 2018 - anno

* Gender
gen male = 0
replace male = 1 if W11_Q007 == 1



*------------------------------------------------------------------------------------------------------------------------------
* ANALYSES
*------------------------------------------------------------------------------------------------------------------------------

*------------------------------------------------------------------------------------------------------------------------------
* Calculate number of observations in the 6 groups
* This reproduces Table 1 in the article

tab fake typen



*------------------------------------------------------------------------------------------------------------------------------
* BASE MODEL
* This reproduces Figure 1 in the article

*--------------------
*** Non-political ***
*--------------------
reg plaus i.fake if typen == 1
* Predictions
margins, at(fake = (0 1))
marginsplot, yscale(r(0 10)) ylab(0 (1) 10) recast(bar) name(base_1, replace) ///
 ytitle(Predicted News Plausibility) xtitle("") title("Non-Political" "News")

*-------------------
*** Against govt ***
*-------------------
reg plaus i.fake if typen == 2
* Predictions
margins, at(fake = (0 1))
marginsplot, yscale(r(0 10)) ylab(0 (1) 10) recast(bar) name(base_2, replace) ///
 ytitle(Predicted News Plausibility) xtitle("") title("Political News" "Against Government")

*---------------
*** Pro govt ***
*---------------
reg plaus i.fake if typen == 3
* Predictions
margins, at(fake = (0 1))
marginsplot, yscale(r(0 10)) ylab(0 (1) 10) recast(bar) name(base_3, replace) ///
 ytitle(Predicted News Plausibility) xtitle("") title("Political News" "Pro-Government")

*** Combine and make figure
graph combine base_1 base_2 base_3, col(3) ycommon b2title(News Type, size(2.5))
* Figure 1
graph export "../figures/figure_1.pdf", replace



*------------------------------------------------------------------------------------------------------------------------------
* FULL MODEL
* This reproduces Figures 2 to 5 in the article + Table A1 in the appendix

*--------------------
*** Non-political ***
*--------------------
reg plaus i.fake##c.polknow_irt##c.gov_eval edu age male if typen == 1
* Table A1 (part 1)
outreg2 using "../tables/table_A1.doc", replace ctitle(Non-political)

** Predictions (for Figures 2 to 4)
* GOV EVALUATION (for Figure 2)
margins, at(gov = (0 (1) 10) fake = (0 1))
marginsplot, yscale(r(0 10)) ylab(0 (1) 10) recast(line) recastci(rline) ci1opts(color(gray)) name(pre_g_1, replace) ///
 xtitle("") ytitle("Predicted News Plausibility") title("Non-Political" "News") ///
 plot1opts(lpattern("l")) plot2opts(lpattern("--")) ci2opts(lpattern("_")) ///
 legend(position(6)) plot( , label("Real" "False"))
* KNOWLEDGE (for Figure 3)
margins, at(polknow_irt = (-1.321181 (0.2) .9834323) fake = (0 1))
marginsplot, yscale(r(0 10)) ylab(0 (1) 10) xlab(-1.4 (0.3) 1) recast(line) recastci(rline) ci1opts(color(gray)) name(pre_k_1, replace) ///
 xtitle("") ytitle("Predicted News Plausibility") title("Non-Political" "News") ///
 plot1opts(lpattern("l")) plot2opts(lpattern("--")) ci2opts(lpattern("_")) ///
 legend(position(6)) plot( , label("Real" "False"))
* INTERACTION (for Figure 4)
* Low knowledge
margins, at(gov = (0 (1) 10) fake = (0 1) polknow_irt = -1.321181)
marginsplot, yscale(r(0 10)) ylab(0 (1) 10) recast(line) recastci(rline) ci1opts(color(gray)) name(pre_int_1a, replace) ///
 xtitle("") ytitle("Predicted News Plausibility") title("Non-Political" "News" "Low Knowledge") ///
 legend(position(6)) plot( , label("Real" "False")) ///
 plot1opts(lpattern("l")) plot2opts(lpattern("--")) ci2opts(lpattern("_"))
* High knowledge
margins, at(gov = (0 (1) 10) fake = (0 1) polknow_irt = .9834323)
marginsplot, yscale(r(0 10)) ylab(0 (1) 10) recast(line) recastci(rline) ci1opts(color(gray)) name(pre_int_1b, replace) ///
 xtitle("") ytitle("Predicted News Plausibility") title("Non-Political" "News" "High Knowledge") ///
 legend(position(6)) plot( , label("Real" "False")) ///
 plot1opts(lpattern("l")) plot2opts(lpattern("--")) ci2opts(lpattern("_"))

 
** Marginal effects (for Figure 5)
margins, dydx (fake) at(gov = (0 (1) 10) polknow_irt = (-1.321181 .9834323))
marginsplot, yscale(r(-4 1)) ylab(-4 (1) 3) recast(line) recastci(rline) ci1opts(color(gray)) yline(0) name(mar_int_1, replace) ///
 xtitle("") ytitle("Effect of Fake vs. Real News") title("Non-Political" "News") ///
 legend(position(6)) plot( , label("Low Knowledge" "High Knowledge")) ///
 plot1opts(lpattern("l")) plot2opts(lpattern("--")) ci2opts(lpattern("_"))


*-------------------
*** Against govt ***
*-------------------
reg plaus i.fake##c.polknow_irt##c.gov_eval edu age male if typen == 2
* Table A1 (part 2)
outreg2 using "../tables/table_A1.doc", append ctitle(Against Gov)

** Predictions (for Figures 2 to 4)
* GOV EVALUATION (for Figure 2)
margins, at(gov = (0 (1) 10) fake = (0 1))
marginsplot, yscale(r(0 10)) ylab(0 (1) 10) recast(line) recastci(rline) ci1opts(color(gray)) name(pre_g_2, replace) ///
 xtitle("") ytitle("Predicted News Plausibility") title("Political News" "Against Government") ///
 plot1opts(lpattern("l")) plot2opts(lpattern("--")) ci2opts(lpattern("_")) ///
 legend(position(6)) plot( , label("Real" "False"))
* KNOWLEDGE (for Figure 3)
margins, at(polknow_irt = (-1.321181 (0.2) .9834323) fake = (0 1))
marginsplot, yscale(r(0 10)) ylab(0 (1) 10) xlab(-1.4 (0.3) 1) recast(line) recastci(rline) ci1opts(color(gray)) name(pre_k_2, replace) ///
 xtitle("") ytitle("Predicted News Plausibility") title("Political News" "Against Government") ///
 plot1opts(lpattern("l")) plot2opts(lpattern("--")) ci2opts(lpattern("_")) ///
 legend(position(6)) plot( , label("Real" "False"))
* INTERACTION (for Figure 4)
* Low knowledge
margins, at(gov = (0 (1) 10) fake = (0 1) polknow_irt = -1.321181)
marginsplot, yscale(r(0 10)) ylab(0 (1) 10) recast(line) recastci(rline) ci1opts(color(gray)) name(pre_int_2a, replace) ///
 xtitle("") ytitle("Predicted News Plausibility") title("Political News" "Against Government" "Low Knowledge") ///
 legend(position(6)) plot( , label("Real" "False")) ///
 plot1opts(lpattern("l")) plot2opts(lpattern("--")) ci2opts(lpattern("_"))
* High knowledge
margins, at(gov = (0 (1) 10) fake = (0 1) polknow_irt = .9834323)
marginsplot, yscale(r(0 10)) ylab(0 (1) 10) recast(line) recastci(rline) ci1opts(color(gray)) name(pre_int_2b, replace) ///
 xtitle("") ytitle("Predicted News Plausibility") title("Political News" "Against Government" "High Knowledge") ///
 legend(position(6)) plot( , label("Real" "False")) ///
 plot1opts(lpattern("l")) plot2opts(lpattern("--")) ci2opts(lpattern("_"))


** Marginal effects (for Figure 5)
margins, dydx (fake) at(gov = (0 (1) 10) polknow_irt = (-1.321181 .9834323))
marginsplot, yscale(r(-4 1)) ylab(-4 (1) 3) recast(line) recastci(rline) ci1opts(color(gray)) yline(0) name(mar_int_2, replace) ///
 xtitle("") ytitle("Effect of Fake vs. Real News") title("Political News" "Against Government") ///
 legend(position(6)) plot( , label("Low Knowledge" "High Knowledge")) ///
 plot1opts(lpattern("l")) plot2opts(lpattern("--")) ci2opts(lpattern("_"))


*---------------
*** Pro govt ***
*---------------
reg plaus i.fake##c.polknow_irt##c.gov_eval edu age male if typen == 3
* Table A1 (part 3)
outreg2 using "../tables/table_A1.doc", append ctitle(Pro Gov)

** Predictions (for Figures 2 to 4)
* GOV EVALUATION (for Figure 2)
margins, at(gov = (0 (1) 10) fake = (0 1))
marginsplot, yscale(r(0 10)) ylab(0 (1) 10) recast(line) recastci(rline) ci1opts(color(gray)) name(pre_g_3, replace) ///
 xtitle("") ytitle("Predicted News Plausibility") title("Political News" "Pro-Government") ///
 plot1opts(lpattern("l")) plot2opts(lpattern("--")) ci2opts(lpattern("_")) ///
 legend(position(6)) plot( , label("Real" "False"))
* KNOWLEDGE (for Figure 3)
margins, at(polknow_irt = (-1.321181 (0.2) .9834323) fake = (0 1))
marginsplot, yscale(r(0 10)) ylab(0 (1) 10) xlab(-1.4 (0.3) 1) recast(line) recastci(rline) ci1opts(color(gray)) name(pre_k_3, replace) ///
 xtitle("") ytitle("Predicted News Plausibility") title("Political News" "Pro-Government") ///
 plot1opts(lpattern("l")) plot2opts(lpattern("--")) ci2opts(lpattern("_")) ///
 legend(position(6)) plot( , label("Real" "False"))
* INTERACTION (for Figure 4)
* Low knowledge
margins, at(gov = (0 (1) 10) fake = (0 1) polknow_irt = -1.321181)
marginsplot, yscale(r(0 10)) ylab(0 (1) 10) recast(line) recastci(rline) ci1opts(color(gray)) name(pre_int_3a, replace) ///
 xtitle("") ytitle("Predicted News Plausibility") title("Political News" "Pro-Government" "Low Knowledge") ///
 legend(position(6)) plot( , label("Real" "False")) ///
 plot1opts(lpattern("l")) plot2opts(lpattern("--")) ci2opts(lpattern("_"))
* High knowledge
margins, at(gov = (0 (1) 10) fake = (0 1) polknow_irt = .9834323)
marginsplot, yscale(r(0 10)) ylab(0 (1) 10) recast(line) recastci(rline) ci1opts(color(gray)) name(pre_int_3b, replace) ///
 xtitle("") ytitle("Predicted News Plausibility") title("Political News" "Pro-Government" "High Knowledge") ///
 legend(position(6)) plot( , label("Real" "False")) ///
 plot1opts(lpattern("l")) plot2opts(lpattern("--")) ci2opts(lpattern("_"))


** Marginal effects (for Figure 5)
margins, dydx (fake) at(gov = (0 (1) 10) polknow_irt = (-1.321181 .9834323))
marginsplot, yscale(r(-4 1)) ylab(-4 (1) 3) recast(line) recastci(rline) ci1opts(color(gray)) yline(0) name(mar_int_3, replace) ///
 xtitle("") ytitle("Effect of Fake vs. Real News") title("Political News" "Pro-Government") ///
 legend(position(6)) plot( , label("Low Knowledge" "High Knowledge")) ///
 plot1opts(lpattern("l")) plot2opts(lpattern("--")) ci2opts(lpattern("_"))


*-------------------------------
*** Combine and make figures ***
*-------------------------------

* Figure 2
graph combine pre_g_1 pre_g_2 pre_g_3, col(3) ycommon b2title(Government Evaluation (0 = Completely Negative; 10 = Completely Positive), size(2.5))
graph export "../figures/figure_2.pdf", replace
* Figure 3
graph combine pre_k_1 pre_k_2 pre_k_3, col(3) ycommon b2title(Political Knowledge, size(2.5))
graph export "../figures/figure_3.pdf", replace
* Figure 4
graph combine pre_int_1a pre_int_2a pre_int_3a pre_int_1b pre_int_2b pre_int_3b, col(3) ycommon b2title(Government Evaluation (0 = Completely Negative; 10 = Completely Positive), size(2.5)) xsize(5) ysize(6)
graph export "../figures/figure_4.pdf", replace
* Figure 5
graph combine mar_int_1 mar_int_2 mar_int_3, col(3) ycommon b2title(Government Evaluation (0 = Completely Negative; 10 = Completely Positive), size(2.5))
graph export "../figures/figure_5.pdf", replace



*------------------------------------------------------------------------------------------------------------------------------
* Appendix 4 - Alternative specification with vote choice instead of government evaluation
* This reproduces Figures A1 to A3 + Table A2 in the appendix

*--------------------
*** Non-political ***
*--------------------
reg plaus i.fake##c.polknow_irt##i.vote_inc edu age male if typen == 1
outreg2 using "../tables/table_A2.doc", replace ctitle(Non-political)

* VOTE FOR INCUMBENT VS. CHALLENGER (for Figure A1)
margins, at(vote_inc = (0 1) fake = (0 1))
marginsplot, yscale(r(0 10)) ylab(0 (1) 10) xscale(r(-0.2 1.2)) recast(scatter) name(vot_g_1, replace) ///
 xtitle("") ytitle("Predicted News Plausibility") title("Non-Political" "News")
* KNOWLEDGE (for Figure A2)
margins, at(polknow_irt = (-1.321181 (0.2) .9834323) fake = (0 1))
marginsplot, yscale(r(0 10)) ylab(0 (1) 10) xlab(-1.4 (0.3) 1) recast(line) recastci(rline) ci1opts(color(gray)) name(vot_k_1, replace) ///
 xtitle("") ytitle("Predicted News Plausibility") title("Non-Political" "News") ///
 plot1opts(lpattern("l")) plot2opts(lpattern("--")) ci2opts(lpattern("_")) ///
 legend(position(6)) plot( , label("Real" "False"))
* INTERACTION (marginal effects, for Figure A3)
margins, dydx (fake) at(vote_inc = (0 1) polknow_irt = (-1.321181 .9834323))
mplotoffset, offset(0.1) recast(scatter) yscale(r(-4 1)) ylab(-4 (1) 3) xscale(r(-0.2 1.2)) yline(0) name(vot_gk_1, replace) ///
 xtitle("") ytitle("Marginal Effect of False vs. Real News") title("Non-Political" "News") ///
 legend(position(6)) plot( , label("Low Knowledge" "High Knowledge"))

*-------------------
*** Against govt ***
*-------------------
reg plaus i.fake##c.polknow_irt##i.vote_inc edu age male if typen == 2
outreg2 using "../tables/table_A2.doc", append ctitle(Against Gov)

* VOTE FOR INCUMBENT VS. CHALLENGER (for Figure A1)
margins, at(vote_inc = (0 1) fake = (0 1))
marginsplot, yscale(r(0 10)) ylab(0 (1) 10) xscale(r(-0.2 1.2)) recast(scatter) name(vot_g_2, replace) ///
 xtitle("") ytitle("Predicted News Plausibility") title("Political News" "Against Government")
* KNOWLEDGE (for Figure A2)
margins, at(polknow_irt = (-1.321181 (0.2) .9834323) fake = (0 1))
marginsplot, yscale(r(0 10)) ylab(0 (1) 10) xlab(-1.4 (0.3) 1) recast(line) recastci(rline) ci1opts(color(gray)) name(vot_k_2, replace) ///
 xtitle("") ytitle("Predicted News Plausibility") title("Political News" "Against Government") ///
 plot1opts(lpattern("l")) plot2opts(lpattern("--")) ci2opts(lpattern("_")) ///
 legend(position(6)) plot( , label("Real" "False"))
* INTERACTION (marginal effects, for Figure A3)
margins, dydx (fake) at(vote_inc = (0 1) polknow_irt = (-1.321181 .9834323))
mplotoffset, offset(0.1) recast(scatter) yscale(r(-4 1)) ylab(-4 (1) 3) xscale(r(-0.2 1.2)) yline(0) name(vot_gk_2, replace) ///
 xtitle("") ytitle("Marginal Effect of False vs. Real News") title("Political News" "Against Government") ///
 legend(position(6)) plot( , label("Low Knowledge" "High Knowledge"))

*---------------
*** Pro govt ***
*---------------
reg plaus i.fake##c.polknow_irt##i.vote_inc edu age male if typen == 3
outreg2 using "../tables/table_A2.doc", append ctitle(Pro Gov)

* VOTE FOR INCUMBENT VS. CHALLENGER (for Figure A1)
margins, at(vote_inc = (0 1) fake = (0 1))
marginsplot, yscale(r(0 10)) ylab(0 (1) 10) xscale(r(-0.2 1.2)) recast(scatter) name(vot_g_3, replace) ///
 xtitle("") ytitle("Predicted News Plausibility") title("Political News" "Pro-Government")
* KNOWLEDGE (for Figure A2)
margins, at(polknow_irt = (-1.321181 (0.2) .9834323) fake = (0 1)) 
marginsplot, yscale(r(0 10)) ylab(0 (1) 10) xlab(-1.4 (0.3) 1) recast(line) recastci(rline) ci1opts(color(gray)) name(vot_k_3, replace) ///
 xtitle("") ytitle("Predicted News Plausibility") title("Political News" "Pro-Government") ///
 plot1opts(lpattern("l")) plot2opts(lpattern("--")) ci2opts(lpattern("_")) ///
 legend(position(6)) plot( , label("Real" "False"))
* INTERACTION (marginal effects, for Figure A3)
margins, dydx (fake) at(vote_inc = (0 1) polknow_irt = (-1.321181 .9834323))
mplotoffset, offset(0.1) recast(scatter) yscale(r(-4 1)) ylab(-4 (1) 3) xscale(r(-0.2 1.2)) yline(0) name(vot_gk_3, replace) ///
 xtitle("") ytitle("Marginal Effect of False vs. Real News") title("Political News" "Pro-Government") ///
 legend(position(6)) plot( , label("Low Knowledge" "High Knowledge"))


*-------------------------------
*** Combine and make figures ***
*-------------------------------

* Figure A1
graph combine vot_g_1 vot_g_2 vot_g_3, col(3) ycommon b2title(Vote choice at past elections (Challenger vs. Incumbent), size(2.5))
graph export "../figures/figure_A1.pdf", replace
* Figure A2
graph combine vot_k_1 vot_k_2 vot_k_3, col(3) ycommon b2title(Political Knowledge, size(2.5))
graph export "../figures/figure_A2.pdf", replace
* Figure A3
graph combine vot_gk_1 vot_gk_2 vot_gk_3, col(3) ycommon b2title(Vote choice at past elections (Challenger vs. Incumbent), size(2.5))
graph export "../figures/figure_A3.pdf", replace



*------------------------------------------------------------------------------------------------------------------------------
* Appendix 5 - Knowledge and government support
* This reproduces the results in Table A3 in the appendix

* Calculate the median of Knowledge (50 percentile = .1229908)
sum polknow_irt, det

* Low-knowledge individuals (below the median, left column)
bysort typen: sum gov_eval if polknow_irt < .1229908
* Low-knowledge individuals (above and equal to the median, right column)
bysort typen: sum gov_eval if polknow_irt >= .1229908



*------------------------------------------------------------------------------------------------------------------------------
* Appendix 6 - Binning estimators models
* This reproduces the results in Table A4 and Figure A4 in the appendix

*--------
* RECODES
*--------

* Recode knowledge in 2 categories
fre polknow_irt
recode polknow_irt (-2/0 = 1 "Low") (0.0000001/1=2 "High"),gen(polknow_bin)

* Recode government evaluation in 3 categories
fre gov_eval
recode gov_eval (0/3 = 1 "Bad") (4/6= 2 "Mid") (7/10=3 "Good"),gen(gov_eval_bin)


*----------------------------
* FULL MODEL WITH INTERACTION
*----------------------------

*** Non-political ***
reg plaus i.fake##i.polknow_bin##i.gov_eval_bin edu age male if typen == 1
outreg2 using "../tables/table_A4.doc", append dec(2)
* Marginal effects, for Figure A4
margins, dydx (fake) at(gov_eval_bin = (1 2 3) polknow_bin = (1 2))
marginsplot, xdim(gov_eval_bin) recast(line) ytitle("Effect of Fake vs. Real News") yscale(r(-4 2))  ///
 title("Non-political" "News") name(fin_gk_1, replace)  yline(0) ylab(-4 (1) 2) xtitle("Govt. eval. recoded") ///
 plot1opts(lpattern("l")) plot2opts(lpattern("--")) ///
 legend(position(6)) plot( , label("Low Knowledge" "High Knowledge"))

*** Against govt ***
reg plaus i.fake##i.polknow_bin##i.gov_eval_bin edu age male if typen == 2
outreg2 using "../tables/table_A4.doc", append dec(2)
* Marginal effects, for Figure A4
margins, dydx (fake) at(gov_eval_bin = (1 2 3) polknow_bin = (1 2))
marginsplot, xdim(gov_eval_bin) recast(line) ytitle("Effect of Fake vs. Real News") yscale(r(-4 2))  ///
 title("Political News" "Anti-Government") name(fin_gk_2, replace)  yline(0) ylab(-4 (1) 2) xtitle("Govt. eval. recoded") ///
 plot1opts(lpattern("l")) plot2opts(lpattern("--")) ///
 legend(position(6)) plot( , label("Low Knowledge" "High Knowledge"))

*** Pro govt ***
reg plaus i.fake##i.polknow_bin##i.gov_eval_bin edu age male if typen == 3
outreg2 using "../tables/table_A4.doc", append dec(2)
* Marginal effects, for Figure A4
margins, dydx (fake) at(gov_eval_bin = (1 2 3) polknow_bin = (1 2))
marginsplot, xdim(gov_eval_bin) recast(line) ytitle("Effect of Fake vs. Real News") yscale(r(-4 2))  ///
 title("Political News" "Pro-Government") name(fin_gk_3, replace)  yline(0) ylab(-4 (1) 2) xtitle("Govt. eval. recoded") ///
 plot1opts(lpattern("l")) plot2opts(lpattern("--")) ///
 legend(position(6)) plot( , label("Low Knowledge" "High Knowledge"))

*------------------------------
*** Combine and make figure ***
*------------------------------
* Figure A4
graph combine fin_gk_1 fin_gk_2 fin_gk_3, col(3)
graph export "../figures/figure_A4.pdf", replace



*------------------------------------------------------------------------------------------------------------------------------
* Appendix 7 - Significance and magnitude of the three-way interaction

*** Save the data to be opened in R for the simulations ***
* Keep only relevant variables
keep plaus fake polknow_irt gov_eval edu age male typen
saveold "data_fakenews_sim.dta", replace

*-------------------------------------------------------------*
*
* Please run the R script file "Appendix7_simulation.R"
*
*-------------------------------------------------------------*

*-------------------------------
*** Graph MSS - Against govt *** 
*-------------------------------

* Import simulated data (produced by the script "Appendix7_simulation.R")
import delimited ./output_AntiGov.csv, clear

* MSS (right column in Table A5)
sum morecases if avgt > 1.96
di r(min)

graph twoway (scatter avgt morecase if morecase<40000) /// 
 (lowess avgt morecase if morecase<40000),scheme(plotplain)  ///
 name(left, replace) xtitle("Avg. cases added") ytitle("Avg t-score for the coeff.") ///
 legend(off) title("Anti-Government model") yline(1.96)

*---------------------------
*** Graph MSS - Pro govt ***
*---------------------------

* Import simulated data (produced by the script "Appendix7_simulation.R")
import delimited ./output_ProGov.csv,clear

* MSS (right column in Table A5)
sum morecases if avgt < -1.96
di r(min)


graph twoway (scatter avgt morecase if morecase<40000) /// 
 (lowess avgt morecase if morecase<40000),scheme(plotplain)  ///
 name(right, replace) xtitle("Avg. cases added") ytitle("Avg t-score for the coeff.") ///
 legend(off) title("Pro-Government model") yline(-1.96)

* Figure A5
graph combine left right, col(2)
graph export "../figures/figure_A5.pdf", replace
